'    Copyright 2008 Jan Molnar <jan.molnar@abds.de>
'
'    This file is part of JCQ.

'    JCQ is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 2 of the License, or
'    (at your option) any later version.

'    JCQ is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with JCQ. If not, see <http://www.gnu.org/licenses/>.

Public Class Snac0405
    Inherits Snac

    Public Sub New()
        MyBase.New(&H4, &H5)
    End Sub

    Public Overrides Function CalculateDataSize() As Integer
        Throw New NotImplementedException
    End Function

    Private _Channel As Integer
    Public Property Channel() As Integer
        Get
            Return _Channel
        End Get
        Set(ByVal value As Integer)
            _Channel = value
        End Set
    End Property


    Private _MessageFlags As Long
    Public Property MessageFlags() As Long
        Get
            Return _MessageFlags
        End Get
        Set(ByVal value As Long)
            _MessageFlags = value
        End Set
    End Property


    Private _MaxMessageSnacSize As Integer
    Public Property MaxMessageSnacSize() As Integer
        Get
            Return _MaxMessageSnacSize
        End Get
        Set(ByVal value As Integer)
            _MaxMessageSnacSize = value
        End Set
    End Property


    Private _MaxSenderWarningLevel As Integer
    Public Property MaxSenderWarningLevel() As Integer
        Get
            Return _MaxSenderWarningLevel
        End Get
        Set(ByVal value As Integer)
            _MaxSenderWarningLevel = value
        End Set
    End Property


    Private _MaxReceiverWarningLevel As Integer
    Public Property MaxReceiverWarningLevel() As Integer
        Get
            Return _MaxReceiverWarningLevel
        End Get
        Set(ByVal value As Integer)
            _MaxReceiverWarningLevel = value
        End Set
    End Property


    Private _MinimumMessageInterval As Integer
    Public Property MinimumMessageInterval() As Integer
        Get
            Return _MinimumMessageInterval
        End Get
        Set(ByVal value As Integer)
            _MinimumMessageInterval = value
        End Set
    End Property

    Public Overrides Sub Deserialize(ByVal data As System.Collections.Generic.List(Of Byte))
        MyBase.Deserialize(data)

        Dim index As Integer = Snac.SizeFixPart

        _Channel = ByteConverter.ToUInt16(data.GetRange(index, 2))
        index += 2

        _MessageFlags = ByteConverter.ToUInt32(data.GetRange(index, 4))
        index += 4

        _MaxMessageSnacSize = ByteConverter.ToUInt16(data.GetRange(index, 2))
        index += 2

        _MaxSenderWarningLevel = ByteConverter.ToUInt16(data.GetRange(index, 2))
        index += 2

        _MaxReceiverWarningLevel = ByteConverter.ToUInt16(data.GetRange(index, 2))
        index += 2

        _MinimumMessageInterval = ByteConverter.ToUInt16(data.GetRange(index, 2))
        index += 2

        'unknown param
        index += 2

        Me.SetTotalSize(index)
    End Sub

    Public Overrides Function Serialize() As System.Collections.Generic.List(Of Byte)
       Throw New NotImplementedException
    End Function
End Class
